<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JSON对象</title>
</head>
<body>

</body>
<script>
  //Object
//  数组对象 [] [value,value,value,value]
//  对象 {} 键值对{key:value,key:value,key:value}
//  key  默认都是string  "" 可以省略不写
  var person = {
    name:"tom",
    age:18,
    address:"武当山"
  }
  console.log(person)

  var person2 = {
    name:"jerry",
    age:20,
    address:["住址1","住址2","住址3","住址4"],
    son:[{name:"ann", age:2},{name:"ann2", age:2},{name:"ann3", age:2}],
    show:function () {
      console.log("show方法")
    }
  }

  console.log(person2)
  console.log(person2.show())
  //JSON工具--》浏览器自带  stringify 对象--》String
  var s = JSON.stringify(person2);
  console.log(s)
  //typeof 获取变量的类型
  console.log(typeof s)
  //parse   String---》 对象
  var p = JSON.parse(s);
  console.log(p)
  console.log(typeof p)
</script>
</html>